from celery import Celery
import os
from django.conf import settings

# 配置环境变量
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "P6_51_django.settings")

# 创建celery应用
app = Celery('myworker')

# 配置app
app.conf.broker_url = "redis://:123456@127.0.0.1:6379/1"
app.conf.result_backend = "redis://:123456@127.0.0.1:6379/2"

# 自动发现任务函数
app.autodiscover_tasks(settings.INSTALLED_APPS)